package com.csweimei.rentmanagementtreasure.enterprise.viewModel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableList;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.http.entity.EntHomeDailyBean;
import com.csweimei.rentmanagementtreasure.viewModel.TitleVM;

import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class EntDpDVM extends TitleVM {
    public EntDpDVM(@NonNull Application application) {
        super(application);
        setTitleText("日报");
    }


    public ObservableField< EntHomeDailyBean.DataDTO> entity = new ObservableField<>();

    public ObservableList<EntDPItem> observableList = new ObservableArrayList<>();
    public ItemBinding<EntDPItem> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_dp_ent);


    @Override
    public void onCreate() {
        super.onCreate();
        observableList.clear();
        for (EntHomeDailyBean.DataDTO.DailyDTO bean : entity.get().getDaily()) {
            EntDPItem item = new EntDPItem(titleVM);
            item.setData(bean);
            observableList.add(item);
        }



    }
}
